import java.awt.*;

import javax.swing.*;

public class ListCellRendererTest {

	public static void main(String[] args) {
		JList list = new JList(new String[] { "Item-1", "Item2", "Item3" });
		list.setCellRenderer(new MyRenderer());
		JScrollPane sp = new JScrollPane(list);
		JFrame f = new JFrame();
		f.getContentPane().add(sp, BorderLayout.CENTER);
		f.pack();
		f.setLocationRelativeTo(null);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.show();
	}

	private static class MyRenderer extends DefaultListCellRenderer {
		private Font font1;
		private Font font2;

		public MyRenderer() {
			this.font1 = getFont();
			this.font2 = font1.deriveFont((float) (font1.getSize() + 10));
		}

		public Component getListCellRendererComponent(JList list, Object value,
				int index, boolean isSelected, boolean cellHasFocus) {
			super.getListCellRendererComponent(list, value, index, isSelected,
					cellHasFocus);
			if (index == 1) {
				setBackground(Color.lightGray);
			}
			setFont(index == 2 ? font2 : font1);

			return this;
		}
	}
}
